<template>
	<div class="app-contain">
		<div class=" mt20">
			<section class="uc-emp-box">
				<ol>
					<li class="ongoing uc-emp-item" v-for="item in examList">
						<div class="emp-s-b-sec ">
							<div class="clearfix e-s-box " style="height: 128px;">
								<div class="mt10 e-s-mod1 "></div>
								<div class="e-s-mod2 ">
									<h3 class="hLh30 e-s-name tac "> 
										<a href="javascript:;" :title="item.exam.name">{{item.exam.name}}</a> 
									</h3>
									<section class="tac mt20">
										<span class="c-fff tac fsize14">总分数：{{item.paper.score}} </span>
									</section>
									<span class="time-bar-wrap"> <span  class="lev-num-wrap">  </span> </span>
									<div class="p-progres-num tac">
										<span class="c-fff fsize14">及格分数：{{item.paper.passScore}}</span>
									</div>
								</div>
							</div>
						</div>
						<div class="plan-attr-wrap ">
							<ul class="clearfix ">
								<li><em class="e-time-icon "></em><span>截止时间:{{item.exam.endtime}}</span></li>
							</ul>
							<ul class="clearfix ">
								<li><span>时间：<tt>{{item.paper.time}}分钟</tt></span></li>
								<li><span>难度：<tt v-show="item.paper.difficulty == 1">简单</tt> <tt v-show="item.paper.difficulty == 2">中等</tt> <tt v-show="item.paper.difficulty == 3">困难</tt></span></li>
								<li><span>考试次数：<tt>{{item.exam.reexam}}</tt></span></li>
								<li><span>已考：<tt>{{item.examTimes}}</tt></span></li>
							</ul>
							<ul class="clearfix exam-button mt10" >
								<li class="fl tac" title="进入考试" @click='joinExam(item)' v-if="item.examTimes<=item.exam.reexam">进入考试</li>
								<li class="fl tac" title="查看成绩单" @click='lookPaperResult(item)'  v-show="item.reexam>0">成绩单</li>
							</ul>
						</div>
						
						
					</li>
				</ol>
				<section class="mt30 mb30 tac u-p-nodata" v-show="examList.length<1">
					<em class="no-data-ico cTipsIco">&nbsp;</em>
					<span class="c-666 fsize14 ml10 vam"> 您 还 没 有考试~ </span>
				</section>
				<div class="clear "></div>
			</section>
		</div>
	</div>
</template>

<script>
		import { getExamList } from '@/api/uc'
	export default {

		name: 'exam',
		computed: {
			userInfo() {
				return this.$store.getters.getStorageInfo;
			}
		},
		created(){
			this.getExamList(this.userInfo.id)
		},
		data() {
			return {
				examList:[]
			}
		},
		methods: {
			getExamList(id){
				getExamList(id).then((res)=>{
					this.examList = res.entity;
				})
			},
			joinExam(item){
				this.$router.push({
					path: '/exam',
					query: {
						examId:item.exam.id,
						paperId: item.paper.id,
						name: item.exam.name,
						type:'EXAM '
					}
				})
			},
			lookPaperResult(item){
				this.$router.push({
					path: '/paperResults',
					query: {
						examId:item.exam.id,
						type:'EXAM '
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import '../../assets/style/uCenter-nxb.scss'
</style>